package com.tjec.project.mdmSynchronous.dao.impl;

import com.tjec.project.mdmSynchronous.dao.ProjectLeaderDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @Author: VillWang
 * @Date: 2020/6/11 16:09
 */
@Service
public class ProjectLeaderImpl implements ProjectLeaderDao {
    @Autowired
    private JdbcTemplate primaryJdbcTemplate;
    @Override
    public List<Map<String, Object>> getProjectLeaderList(long max) {
        String sql = "SELECT [项目负责人全局ID] as globalId, [项目负责人显示名称全局ID] as userGlobalId,[负责人代码] as leadNo,\n" +
                "[显示名称] userName ,[显示员工编号] jobNo, CONVERT(BIGINT,项目负责人时间戳) timestamp,[是否允许使用企业专家库] flag\n" +
                "FROM [TO_EC_项目负责人] ";
        if(max>0){
            sql=sql+ " where CONVERT(BIGINT,项目负责人时间戳)>"+max;
        }
        List<Map<String, Object>>  userList = primaryJdbcTemplate.queryForList(sql);
        return userList;
    }
}
